﻿using System.IO;

namespace Bookvar.Common
{
    public static class StreamUtility
    {
        private const int BufferSize = 1024;

        public static void CopyStream( Stream source, Stream target )
        {
            source.Seek( 0, SeekOrigin.Begin );
            byte[] buffer = new byte[ BufferSize ];
            int bytesRead;
            while ( ( bytesRead = source.Read( buffer, 0, BufferSize ) ) > 0 )
            {
                target.Write( buffer, 0, bytesRead );
            }
        }
    }
}